<? 

$title="Member registration";
require("required/dbconnect.php");
require("required/share_function.php");
$_SESSION['pid']=0;
require("required/header.php"); 
if(!empty($_SESSION['loginid']))
{
?>
<script type="text/javascript">
<!--
window.location = "index.php"
//-->
</script>

<?

}	
?>
<script type="text/javascript" src="required/calendarDateInput.js"></script>
<script language="JavaScript" type="text/javascript" src="required/js/goAjax.js"></script>
<script language="javascript">
	function checkExist(field,divName,showName) {
		var value = document.getElementById(field).value;
		
		if(value!=""){
			changeContent('required/js/checkExist.php?field='+field+'&value='+value+"&showName="+showName,divName)
		}
	}

	function formvalidate(frm1)
	{
	
		if(document.frm1.email.value=="")
		{
			alert("Please enter your email");
			document.frm1.email.focus();
			return false;
		}
		if (document.frm1.email.value!="")
 		{
			var x = document.frm1.email.value;
			var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			if (filter.test(x)==false)
			{ 
				alert('Please enter a valid email address');
				document.frm1.email.focus();
				return false;
			}
		
  		}
		if(document.frm1.password.value=="")
		{
			alert("Please enter password");
			document.frm1.password.focus();
			return false;
		}
		if(document.frm1.password.value.length<6)
		{
			alert("Password length must be more than 6 characters");
			document.frm1.password.focus();
			return false;
		}
		if(document.frm1.password.value.indexOf(" ")>-1)
		{
			alert("No spacing allowed!");
			document.frm1.password.focus();
			return false;
		}
		if(document.frm1.cpassword.value=="")
		{
			alert("Please re-enter your password");
			document.frm1.cpassword.focus();
			return false;
		}
		if(document.frm1.password.value!=document.frm1.cpassword.value)
		{
			alert("Password doesn't match, please check");
			document.frm1.cpassword.focus();
			return false;
		}
		if(document.frm1.verification_code.value=="")
		{
			alert("Please enter the verification code");
			document.frm1.verification_code.focus();
			return false;
		}
		
		if(document.frm1.name.value=="")
		{
			alert("Please enter your name");
			document.frm1.name.focus();
			return false;
		}
		if(document.frm1.hpnumber.value=="")
		{
			alert("Please enter your contact number");
			document.frm1.hpnumber.focus();
			return false;
		}
		
		
		return true;
	}
	
</script>


		
			<table width="100%" cellpadding="6" cellspacing="0">
				<tr>
					<td class="page_title_bar">
					Activate Online Membership
							
					</td>
										
				</tr>	
				<tr>
					<td align="center">
						<table width="100%" height="100%">
							
							<form action="os_activate_membership2.php" method="post" name="frm1" onSubmit="return formvalidate(this)">
																			
								<tr>
									<td height="20" colspan="3"><strong></strong></td>
								</tr>
								
								<tr>
									<td colspan="3"><font color="#FF0000">*</font> indicates mandatory field </td>
								</tr>
								<tr valign="top">
									<td width="331">Email<font color="#FF0000">*</font></td>
								  <td width="3">:</td>
								  <td><input type="text" size="20" maxlength="80" name="email"><br>Please enter the email address that you provided to us									
									</td>
								</tr>
                                <tr valign="top">
									<td width="331">Member Card Number<font color="#FF0000">*</font></td>
								  <td width="3">:</td>
								  <td><input type="text" size="20" maxlength="80" name="member_card_number"><br>Please enter your member card number

									</td>
								</tr>
                                
								<tr valign="top">
									<td>Password<font color="#FF0000">*</font></td><td>:</td><td><input type="password" size="20" maxlength="15" name="password"><br> Password length must be more than 6 characters (case sensitive)</td>
								</tr>
								<tr>
									<td>Confirm password<font color="#FF0000">*</font></td><td>:</td><td><input type="password" size="20" maxlength="15" name="cpassword"></td>
								</tr>
                                
								<tr>
									<td>I would like to register as </td><td>:</td><td>
										<input type="radio" checked="checked" name="member_type" value="N"/> Normal User
                                        <input type="radio"  name="member_type" value="V" /> VIP (RM10 for registration fee)
                                    </td>
								</tr>
								
								<tr>
									<td>Name<font color="#FF0000">*</font></td><td>:</td><td><input type="text" size="20" maxlength="50" name="name"></td>
								</tr>
								<tr>
									<td>Gender</td><td>:</td><td><input type="radio" name="sex" value="male" checked>Male<input type="radio" name="sex" value="female">Female</td>
								</tr>
								<tr>
									<td>Birth date</td><td>:</td><td><script>DateInput('dob', true, 'YYYY-MM-DD')</script></td>
								</tr>
								<tr>
									<td>Contact number<font color="#FF0000">*</font></td><td>:</td><td><input type="text" size="20" maxlength="20" name="hpnumber"><br></td>
								</tr>
                                <tr>
									<td>Verification code<font color="#FF0000">*</font></td><td>:</td><td>
									<input type="text" class="text" size="4" maxlength="4" name="verification_code">
									<iframe name="I1" src="verycode.php" width="100" height="20" frameborder=0 scrolling=no  marginheight="2"></iframe>   </td>
								</tr>
								<tr>
									<td colspan="3" align="center"><input type="submit" value="Submit" class="button">
							
									<input type="reset" value="Reset" class="button">
									</td>
								</tr>	
								</form>
							</table>
						</td>
					</tr>
				</table>
			
<? require("required/footer.php"); ?>